package com.itheima.api.map.demo02;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class MapDemo01 {

    public static void main(String[] args) {

        Map<String, String> map = new HashMap<String, String>();

        map.put("段誉", "王语嫣");
        map.put("乔峰", "阿朱");
        map.put("虚竹", "天山童姥");

        Set<Map.Entry<String, String>> entrySet = map.entrySet();

        for(Map.Entry<String, String> entry : entrySet) {

            String key = entry.getKey();
            String value = entry.getValue();
            System.out.println(key + "----" + value);

        }

        System.out.println("-------------------------------------------");

        map.forEach((s1, s2) -> {
            System.out.println(s1 + "----" + s2);
        });

    }

}
